//
//  messageCell.m
//  小钱钱
//
//  Created by sdzhqy on 2017/3/20.
//  Copyright © 2017年 sdzhqy. All rights reserved.
//

#import "messageCell.h"
#import <UIView+SDAutoLayout.h>
#import <UITableView+SDAutoTableViewCellHeight.h>
#import "common.h"
@implementation messageCell
{
    UILabel *namelab;
    UILabel *timelab;
    UILabel *contentlab;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setup];
    }
    return self;
}
-(void)setup
{
    namelab=[[UILabel alloc]init];
    namelab.backgroundColor=[UIColor grayColor];
    timelab=[[UILabel alloc]init];
    timelab.backgroundColor=[UIColor greenColor];
    contentlab=[[UILabel alloc]init];
    contentlab.backgroundColor=[UIColor blueColor];
    [self.contentView addSubview:namelab];
    [self.contentView addSubview:timelab];
    [self.contentView addSubview:contentlab];
    namelab.sd_layout.widthIs(50).heightIs(30).leftSpaceToView(self.contentView,10).topSpaceToView(self.contentView,10);
    timelab.sd_layout.widthIs(50).heightIs(30).leftSpaceToView(self.contentView,10).topSpaceToView(self.contentView,50);
    contentlab.sd_layout.widthIs(50).heightIs(30).leftSpaceToView(self.contentView,10).topSpaceToView(self.contentView,90);
}
-(void)setModel:(messageModel *)model
{
    _model=model;
    namelab.text=_model.messagename;
    timelab.text=_model.messagetime;
    contentlab.text=_model.messagecontent;
    [self setupAutoHeightWithBottomView:contentlab bottomMargin:10];
}
@end
